<template>
	<Loading @change="closeLoad" v-if="load"/>
	<div class="app-box" v-else>
		<!-- <div class="app-header-box">123</div> -->
		<!-- <Header /> -->
		<div class="app-body-box">
			<Sidbar @change="sidbarChange"/>
			<Body v-if="currentIndex==1" />
			<ChatGpt v-if="currentIndex==2" />
		</div>
	</div>
	<!-- <Header /> -->
</template>

<script setup lang="ts">
import { ref,onMounted } from "vue";
import Loading from './components/Loading.vue'
// import Header from './components/Header.vue'
import Sidbar from './components/Sidbar.vue'
import Body from './components/Body.vue'
import ChatGpt from './components/chatGpt/Index.vue'



const load=ref(true);
const currentIndex=ref(1);


onMounted(()=>{

	/* const ES: EventSource = new EventSource('/push');
	// 监听收到推送处理逻辑
	ES.onmessage = (e: MessageEvent) => {
		console.log(e.data);
	}
	// 监听建立连接
	ES.onopen = () => {
		console.log('建立连接');
	}
	ES.onerror = (e: MessageEvent) => {
		console.log(e);
	} */


});


const sidbarChange = (item:any) => {
	currentIndex.value = item.index
}

const closeLoad = () => {
	load.value = false
}

</script>

<style scoped>
	.app-box{
		display: flex;
		flex-direction:column;
		width:100%;
		height:100%;
	}

	.app-body-box{
		flex:1;
		display: flex;
		overflow: auto;
	}

</style>
